_G.zf_common = {}

local function tableToString(t, indent)
	indent = indent or 0
    local indentStr = string.rep("  ", indent)
    local result = ""
    if type(t) ~= "table" then
        return tostring(t)
    end

    result = result .. "{\n"
    for k, v in pairs(t) do
        local keyStr = type(k) == "string" and "\"" .. k .. "\"" or tostring(k)
        
        if type(v) == "table" then
            result = result .. indentStr .. "  " .. keyStr .. " = " .. tableToString(v, indent + 1) .. ",\n"
        else
            local valueStr
            if type(v) == "string" then
                valueStr = "\"" .. v .. "\""
            else
                valueStr = tostring(v)
            end
            result = result .. indentStr .. "  " .. keyStr .. " = " .. valueStr .. ",\n"
        end
    end
    result = result .. indentStr .. "}"
    return result
end

_G.zf_common.tableToString = tableToString